//
//  ArrayUnits.m
//  JQBV2
//
//  Created by dev on 14-8-25.
//  Copyright (c) 2014年 EFunds. All rights reserved.
//

#import "ArrayUnits.h"

@implementation ArrayUnits

+ (BOOL)haveEmptyObject:(NSArray *)array withCount:(int)count{
    if (array.count != count) {
        return YES;
    }else{
        for (id object in array) {
            if (object == [NSNull null]||object == nil) {
                return YES;
            }else{
                if ([object isKindOfClass:[NSString class]] && [(NSString *)object isEqualToString:@""]) {
                    return YES;
                }
            }
        }
    }
    return NO;
}

+ (BOOL)isEmptyArray:(id)array{
    if (![array isKindOfClass:[NSArray class]]) {
        return YES;
    }
    return [(NSArray *)array count] <= 0;
}

+ (id) objectInArray:(NSArray *)array withIndex:(NSUInteger)index{
    if ([ArrayUnits isEmptyArray:array]) {
        return nil;
    }else if (array.count > index){
        return [array objectAtIndex:index];
    }
    return nil;
}

@end
